package itu.dk.bosk.ex8_4;

public class TestOwnExceptions {

	public static void main(String[] args) {

		System.out.println("Kalder throwMyCheckedException");
                try {
                    throwMyCheckedException();
                } catch (MyCheckedException ex) {
                    System.out.println("Caught a MyCheckedException..");
                }
		System.out.println("Kalder throwMyUncheckedException med try-catch");
		try {
                    throwMyUncheckedException();
                } catch (MyUncheckedException ex) {
                    System.out.println("Caught a MyUncheckedException..");
                }
                System.out.println("Kalder throwMyUncheckedException uden try-catch");
                throwMyUncheckedException();
	}

	public static void throwMyCheckedException() throws MyCheckedException {
            throw new MyCheckedException();
	}

	public static void throwMyUncheckedException() throws MyUncheckedException{
            throw new MyUncheckedException();
	}

        public static class MyCheckedException extends Exception{
            MyCheckedException(){super();}
            MyCheckedException(String s){ super(s); }
        }

    private static class MyUncheckedException extends RuntimeException{
        public MyUncheckedException(){super();}
        public MyUncheckedException(String s){super(s);}
    }
}
